<template>
  <div class="RightFzjkDetails bigTableStyle">
    <div class="elForm-box">
      <el-form :model="formData" size="medium" label-width="1.4rem">
        <el-row :gutter="15">
          <el-col :span="6">
            <el-row :gutter="15">
              <el-col :span="24">
                <el-form-item label="变电站名称:" prop="time">
                  <el-select
                    v-model="formData.cities"
                    placeholder="请选择变电站"
                    clearable
                    disabled
                    :style="{ width: '100%' }"
                    filterable
                  >
                    <el-option
                      v-for="(item) in stationList"
                      :key="item.stationId"
                      :label="item.stationName"
                      :value="item.stationId"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
          </el-col>
          <el-col :span="6">
            <el-row :gutter="15">
              <el-col :span="24">
                <el-form-item label="所属系统:">
                  <el-select
                    v-model="formData.substation"
                    placeholder="请选择所属系统"
                    clearable
                    filterable
                    :style="{ width: '100%' }"
                  >
                    <el-option
                      v-for="(item, index) in getSystemList"
                      :key="index"
                      :label="item.systemName"
                      :value="item.systemId"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
          </el-col>
          <el-col :span="6">
            <el-row :gutter="15">
              <el-col :span="24">
                <el-form-item label="所属区域:" prop="source">
                  <el-select
                    v-model="formData.sideShot"
                    placeholder="请选择所属区域"
                    clearable
                    disabled
                    :style="{ width: '100%' }"
                  >
                    <el-option
                      v-for="(item,index) in getAreaList"
                      :key="index"
                      :label="item.areaName"
                      :value="item.areaId"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
          </el-col>
          <el-col :span="6">
            <el-row :gutter="15">
              <el-col :span="24">
                <el-form-item label="设备名称:" prop="source">
                  <el-input
                    v-model="formData.system"
                    placeholder="请输入设备名称"
                    :style="{ width: '100%' }"
                  />
                </el-form-item>
              </el-col>
            </el-row>
          </el-col>
        </el-row>
        <el-row :gutter="15">
          <el-col :span="6">
            <el-row :gutter="15">
              <el-col :span="24">
                <el-form-item label="设备类型:" prop="time">
                  <el-select
                    v-model="formData.getDevice"
                    placeholder="请选择设备类型"
                    clearable
                    filterable
                    :style="{ width: '100%' }"
                  >
                    <el-option
                      v-for="(item, index) in getDeviceTypeList"
                      :key="index"
                      :label="item.deviceTypeName"
                      :value="item.deviceTypeId"
                      :disabled="item.disabled"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
          </el-col>
          <el-col :span="6">
            <el-row :gutter="15">
              <el-col :span="24">
                <el-form-item label="关联一次/二次设备名称:" prop>
                  <el-select
                    v-model="formData.sfts"
                    placeholder
                    clearable
                    filterable
                    :style="{ width: '100%' }"
                  >
                    <el-option
                      v-for="(item, index) in sftsOptions"
                      :key="index"
                      :label="item.interval"
                      :value="item.id"
                      :disabled="item.disabled"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
          </el-col>
          <el-col :span="12">
            <div class="inspection-report-index-btn">
              <el-button type="primary" @click="query">查询</el-button>
              <el-button type="primary" @click="submitForm">新建</el-button>
              <el-button @click="cutOut" type="primary">删除</el-button>
              <el-button type="primary" @click="modify">修改</el-button>
              <el-button type="primary" @click="templateDownload">模板下载</el-button>
              <el-button @click="mbgx" type="primary">模板导入</el-button>
            </div>
          </el-col>
        </el-row>
      </el-form>
    </div>
    <div class="tableed bigTableStyle">
      <el-table
      border
        :data="tableData"
        height="100%"
        :row-class-name="tableRowClassName"
        style="width: 100%;"
        @selection-change="handleSelectionChange"
      >
        <el-table-column type="selection" width="50"></el-table-column>
        <el-table-column prop="myIndex" label="序号" width="60"></el-table-column>
        <el-table-column prop="stationName" label="变电站名称" width="150" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="system" label="所属系统名称" width="120" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="areaName" label="所属区域" width="100" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="deviceName" label="设备名称" width="150" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="typeName" label="设备类型" min-width="50" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="status" label="运行状态" width="100" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="runDate" label="投运日期" width="180" :show-overflow-tooltip="true">
          <template slot-scope="scope">
            <span>{{scope.row.runDate | time}}</span>
          </template>
        </el-table-column>
        <el-table-column
          prop="address"
          label="关联一次/二次设备名称"
          min-width="100"
          :show-overflow-tooltip="true"
        ></el-table-column>
      </el-table>
    </div>
    <div class="paged elPaginationStyle">
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="pages.page"
        :page-sizes="[10, 15, 20]"
        :page-size="pages.pageSize"
        layout="total,prev, pager, next,sizes, jumper"
        :total="pages.totalSize"
      ></el-pagination>
    </div>
    <el-dialog
      :title="PopUptitle"
      :visible.sync="dialogVisible"
      width="8.49rem"
      :before-close="handleClose"
    >
      <el-form
        v-if="dialogVisible"
        ref="elForm"
        :model="PopUpformData"
        size="medium"
        label-width="1.2rem"
        :rules="rules"
        class="popUp-from"
      >
        <el-row>
          <el-col :offset="1" :span="10">
            <el-form-item label="变电站名称" prop="stationId">
              <el-select
                v-model="PopUpformData.stationId"
                placeholder="请选择变电站"
                clearable
                filterable
                :disabled="is"
                @change="bdzmcs"
                :style="{ width: '100%' }"
              >
                <el-option
                  v-for="(item) in stationList "
                  :key="item.stationId"
                  :label="item.stationName"
                  :value="item.stationId"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :offset="1" :span="10">
            <el-form-item label="区域名称" prop="area">
              <el-select
                v-model="PopUpformData.area"
                placeholder="请选择变电站"
                :disabled="is"
                clearable
                :style="{ width: '100%' }"
              >
                <el-option
                  v-for="(item,index) in getAreaList"
                  :key="index"
                  :label="item.areaName"
                  :value="item.areaId"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :offset="1" :span="10">
            <el-form-item label="装置类型" prop="deviceType">
              <el-select
                v-model="PopUpformData.deviceType"
                placeholder
                clearable
                :style="{ width: '100%' }"
              >
                <el-option
                  v-for="(item, index) in getDeviceTypeList"
                  :key="index"
                  :label="item.deviceTypeName"
                  :value="item.deviceTypeId"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :offset="1" :span="10">
            <el-form-item label="装置名称" prop="deviceName">
              <el-input v-model="PopUpformData.deviceName"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :offset="1" :span="10">
            <el-form-item label="运行状态" prop="status">
              <el-select v-model="PopUpformData.status" placeholder clearable>
                <el-option
                  v-for="(item, index) in getRunstatusList"
                  :key="index"
                  :label="item.name"
                  :value="item.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :offset="1" :span="10">
            <el-form-item label="所属系统:" prop="system">
              <el-select
                v-model="PopUpformData.system"
                placeholder="请选择所属系统"
                :disabled="systemDisabled"
                clearable
                :style="{ width: '100%' }"
              >
                <el-option
                  v-for="(item, index) in getSystemList"
                  :key="index"
                  :label="item.systemName"
                  :value="item.systemId"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :offset="1" :span="10">
            <el-form-item label="型号" prop="modle">
              <el-input v-model="PopUpformData.modle"></el-input>
            </el-form-item>
          </el-col>
          <el-col :offset="1" :span="10">
            <el-form-item label="安装位置" prop="location">
              <el-input v-model="PopUpformData.location"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :offset="1" :span="10">
            <el-form-item label="投运日期" prop="run_date">
              <el-date-picker
                :style="{width: '100%'}"
                v-model="PopUpformData.run_date"
                type="datetime"
                placeholder="选择日期时间"
                value-format="yyyy-MM-dd HH:mm:ss"
                popper-class="times"
              ></el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :offset="1" :span="10">
            <el-form-item label="生产国家" prop="scgj">
              <el-input v-model="PopUpformData.scgj"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :offset="1" :span="10">
            <el-form-item label="出厂编号" prop="production_num">
              <el-input v-model="PopUpformData.production_num"></el-input>
            </el-form-item>
          </el-col>
          <el-col :offset="1" :span="10">
            <el-form-item label="出厂日期" prop="production_date">
              <el-date-picker
                :style="{width: '100%'}"
                v-model="PopUpformData.production_date"
                type="datetime"
                placeholder="选择日期时间"
                value-format="yyyy-MM-dd HH:mm:ss"
                popper-class="times"
              ></el-date-picker>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :offset="1" :span="10">
            <el-form-item label="备注" prop="remark">
              <el-input v-model="PopUpformData.remark"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row class="buttom-box">
          <el-button type="primary" @click="determine">确定</el-button>
          <el-button type="primary" @click="handleClose">取消</el-button>
        </el-row>
      </el-form>
    </el-dialog>
    <input
      id="file0"
      type="file"
      name="file"
      v-if="isShowFile"
      accept="application/vnd.ms-excel"
      @change="fileUpload"
    />
  </div>
</template>

<script lang="ts">
import { Component, Vue, Watch } from "vue-property-decorator";
import { publicAPIModule } from "@/store/modules/public";
import time from "@/utils/time.js";
import { ParameterManagementModule } from "@/store/modules/ParameterManagement";
@Component({
  filters: {
    time(time: any) {
      const dateTime = new Date(time);
      const year = dateTime.getFullYear();
      const month = dateTime.getMonth() + 1;
      const data = dateTime.getDate() + 1;
      const hour = dateTime.getHours();
      const minute = dateTime.getMinutes();
      const second = dateTime.getSeconds();

      function addZero(v) {
        return v < 10 ? "0" + v : v;
      }
      return `${year}-${addZero(month)}-${addZero(data)} ${addZero(
        hour
      )}:${addZero(minute)}:${addZero(second)}`;
    },
  },
})
export default class RightFzjkDetails extends Vue {
  //弹框状态
  public dialogVisible: boolean = false;
  //弹框表单
  public PopUpformData: object = {
    stationId: "",
    area: "",
    deviceType: "",
    deviceName: "",
    status: "",
    // sysName: "",
    system: "",
    modle: "",
    installposdesc: "",
    run_date: "",
    scgj: "",
    production_num: "",
    production_date: "",
    remark: "",
    stationName: "",
  };
  // 所属系统是否禁用
  systemDisabled = false;
  // 运行状态
  getRunstatusList = [
    {
      name: "现场留用",
      value: "31",
    },
    {
      name: "在运",
      value: "20",
    },
    {
      name: "退役",
      value: "30",
    },
  ];
  rules = {
    stationId: [{ required: true, message: "请输入内容", trigger: "blur" }],
    area: [{ required: true, message: "请输入内容", trigger: "blur" }],
    deviceType: [{ required: true, message: "请输入内容", trigger: "blur" }],
    system: [{ required: true, message: "请输入内容", trigger: "blur" }],
    // modle: [{ required: true, message: "请输入内容", trigger: "blur" }],
    // location: [{ required: true, message: "请输入内容", trigger: "blur" }],
    // run_date: [{ required: true, message: "请输入内容", trigger: "blur" }],
    // scgj: [{ required: true, message: "请输入内容", trigger: "blur" }],
    // production_num: [{ required: true, message: "请输入内容", trigger: "blur" }],
    // production_date: [{ required: true, message: "请输入内容", trigger: "blur" }],
    // remark: [{ required: true, message: "请输入内容", trigger: "blur" }],
  };
  $refs!: {
    elForm: any;
  };
  //删除ID
  id = "";
  //弹框title
  public PopUptitle: string = "";
  //搜索框from表单数据
  formData = {
    cities: "",
    substation: "",
    sideShot: "",
    getDevice: "",
    system: "",
    sfts: "",
  };
  sftsOptions = [];
  stationList = [];
  substationOptions = [];
  // 在线运行下拉
  changVal: "";
  //新增数据
  zbldXz = {};

  //table表格相关事件数据
  tableData = [
    {
      date: "1",
      name: "xxxxxx",
      address: "xxxxxxxxxxxxxxxxxxxxxxx",
    },
  ];
  @Watch("formData", { immediate: true, deep: true })
  public changeTop(to: any) {
    this.query();
    // (this as any).formData.system
  }
  @Watch("treeId", { immediate: true, deep: true })
  changeTree() {
    this.topDeviceName();
  }

  //选择数据
  public multipleSelection: Array<any> = [];

  //是否展示文件 选择上传
  isShowFile = true;
  //模板导入
  mbgx() {
    document.getElementById("file0").click();
  }
  // 设备名称传入
  topDeviceName() {
    // console.log(this.TreeId)
    if (this.TreeId === "sb") {
      // 最后一层
      (this as any).formData.system = this.deName || "";
    } else {
      (this as any).formData.system = "";
    }
  }
  //模板导入
  fileUpload() {
    //  console.log(111);
    this.isShowFile = false;
    var files = (document.getElementById("file0") as any).files[0];
    var fd = new FormData();
    fd.append("excelFile", files);
    // var stationId=this.bdzId || ""
    // var stationName= this.stationList.filter(o=>o.stationId==this.bdzId)[0].stationName || ""
    // var area= this.parentId || ""
    // fd.append('bdzid',stationId);
    // fd.append('bdzmc',stationName);
    // fd.append('area',area);

    (this as any).$services
      .importExcel({
        data: fd,
        method: "post",
        processData: false,
        contentType: false,
        fromdata: true,
      })
      .then((result: any) => {
        this.$message({
          showClose: true,
          message: "导入成功",
          type: "success",
        });
        this.init();
        this.isShowFile = true;
      })
      .catch((err: any) => {
        console.log(err);

        this.$message({
          showClose: true,
          message: err.msg,
          type: "warning",
        });
        this.isShowFile = true;
      });
  }
  // 模板下载
  templateDownload(item): void {
    // http://10.193.23.78:18082/tz/辅助设备模板.xlsx

    var a = document.createElement("a");
    a.download = name || "pic";
    a.href = "/tzglMb/fzsbmb.xlsx";
    a.click();
  }
  //删除
  cutOut() {
    // console.log("删除");
    if (this.multipleSelection.length > 0) {
      this.$confirm("是否删除", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          (this as any).$services
            .deleteFkDevice({ data: { ids: this.id }, method: "delete" })
            .then((result: any) => {
              //  console.log(result);
              if (result.code === 200) {
                this.$message({
                  showClose: true,
                  message: result.message,
                  type: "success",
                });
                this.init();
              } else {
                this.$message({
                  showClose: true,
                  message: result.message,
                  type: "warning",
                });
              }
            })
            .catch((err: object) => {
              console.log(err);
            });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消",
          });
        });
    } else {
      this.$message({
        showClose: true,
        message: "至少选择一条",
        type: "warning",
      });
    }
  }
  //分页数据事件相关
  public pages: any = {
    pageSize: 10,
    page: 1,
    totalSize: 120,
  };
  get treeSbSsdsId() {
    return ParameterManagementModule.treeSbIdName.ssdsId;
  }
  get bdzId() {
    return ParameterManagementModule.treeSbIdName.bdzId;
  }
  get parentId() {
    console.log(ParameterManagementModule.treeSbIdName);
    return ParameterManagementModule.treeSbIdName.parentId;
  }
  get treeId() {
    return ParameterManagementModule.treeSbIdName.treeId;
  }
  get TreeId() {
    return ParameterManagementModule.TreeId;
  }
  // 树图最后一层设备名称
  get deName() {
    return ParameterManagementModule.treeSbIdName.name;
  }
  get getAreaList() {
    return ParameterManagementModule.getAreaList;
  }
  get getDeviceTypeList() {
    return ParameterManagementModule.getDeviceTypeList;
  }

  //系统名称
  get getSystemList() {
    // console.log(ParameterManagementModule.getSystemList);

    return ParameterManagementModule.getSystemList;
  }
  //   分页
  handleSizeChange(val: any) {
    // console.log(`每页 ${val} 条`);
    this.pages.pageSize = val;
    this.init();
  }
  // 分页事件
  handleCurrentChange(val: any) {
    this.$emit("setPageIndex", val);
    this.pages.page = val;
    this.init();
  }
  tableRowClassName({ row, rowIndex }: any): string {
    // console.log(row, rowIndex);
    if (rowIndex % 2 === 0) {
      return "row1";
    } else {
      return "row2";
    }
  }
  //表格数据
  handleSelectionChange(val: any) {
    // console.log(val);

    this.multipleSelection = val;
    this.id = "";
    this.multipleSelection.map((item: any) => {
      this.id = this.id + "," + item.deviceId;
    });
    this.id = this.id.substr(1);
  }
  bdzmcs(val) {
    // console.log(val);
    let resultArr = this.stationList.filter((item) => {
      return item.stationId === val;
    });
    return resultArr[0].stationName;
    // console.log((this as any).PopUpformData);
  }
  //查询
  query() {
    this.init();
  }
  is = false;
  //新建
  submitForm() {
    this.PopUptitle = "新建";
    this.systemDisabled = false;
    this.is = true;
    (this as any).PopUpformData.area = this.formData.sideShot;
    (this as any).PopUpformData.stationId = this.bdzId;
    this.dialogVisible = true;
  }
  // getTypeChange() {
  //   console.log(1111);
  //   (this as any).changVal = this.getRunstatusList.filter((item) => {

  //   });
  // }
  // 修改
  modify() {
    this.PopUptitle = "修改";
    this.is = false;
    // console.log(this.multipleSelection );

    // (this.PopUpformData as any).bdzmc = "1";
    if (this.multipleSelection.length != 1) {
      this.$message({
        type: "warning",
        message: "请勾选一条数据",
      });
    } else {
      // console.log((this as any).multipleSelection[0])
      this.systemDisabled = true;
      if ((this as any).multipleSelection[0].status) {
        (this as any).changVal = this.getRunstatusList.filter(
          (o) => o.name == (this as any).multipleSelection[0].status
        )[0].value;
      } else {
        (this as any).changVal = "";
      }
      // 获取列表信息
      this.PopUpformData = {
        stationId: (this as any).multipleSelection[0].stationId || "",
        area: (this as any).multipleSelection[0].area || "",
        deviceType: (this as any).multipleSelection[0].deviceType || "",
        deviceName: (this as any).multipleSelection[0].deviceName || "",
        // status: (this as any).multipleSelection[0].status || "",
        status: (this as any).changVal,
        system: (this as any).multipleSelection[0].system || "",
        modle: (this as any).multipleSelection[0].modle || "",
        location: (this as any).multipleSelection[0].installposdesc || "",
        run_date: (this as any).multipleSelection[0].runDate || "",
        scgj: (this as any).multipleSelection[0].madein || "",
        production_num: (this as any).multipleSelection[0].productionNum || "",
        production_date:
          (this as any).multipleSelection[0].production_date || "",
        remark: (this as any).multipleSelection[0].remark || "",
        stationName: (this as any).multipleSelection[0].stationName || "",
      };
      this.dialogVisible = true;
    }
  }
  //关闭弹框
  handleClose() {
    Object.keys(this.PopUpformData).forEach((key: string) => {
      this.PopUpformData[key] = "";
    });
    this.dialogVisible = false;
  }
  init() {
    var from = {
      page: "",
      size: "",
      area: "",
      deviceName: "",
      deviceType: "",
      station: "",
      system: "",
    };
    from.page = this.pages.page;
    from.size = this.pages.pageSize;
    from.area = this.parentId || "";
    from.deviceName = this.formData.system;
    from.deviceType = this.formData.getDevice;
    from.station = this.bdzId;
    from.system = this.formData.substation;
    var _this = this;
    // console.log(from);
    (this as any).$services
      .queryFkDevice({ data: from, method: "post", postparams: true })
      .then((result: any) => {
        // console.log();
        _this.pages.totalSize = result.data.total;

        let tableData = result.data.records;
          let page = this.pages.page;
      let size = this.pages.pageSize;
        if (tableData && tableData.length) {
          tableData.forEach((v,i) => {
            // console.log(v)
            v.alarmTime = time(v.alarmTime) || "";
            v.dataTime = time(v.dataTime) || "";
            v.run_date = time(v.run_date) || "";

        v.myIndex = (page - 1) * size + i + 1;

          });
        }
        _this.tableData = tableData;

        // _this.tableData = result.data.records;
        // console.log(_this.tableData);
      })
      .catch((err: object) => {
        this.tableData = [];
        console.log(err);
      });
  }
  //弹框确定按钮
  determine() {
    this.$refs.elForm.validate((valid: any) => {
      if (!valid) {
        this.$message({
          type: "warning",
          message: "表单校验不通过",
        });
        return;
      }
      if (this.PopUptitle === "新建") {
        var froms = {
          area: (this as any).PopUpformData.area,
          deviceName: (this as any).PopUpformData.deviceName || "",
          deviceType: (this as any).PopUpformData.deviceType || "",
          status: (this as any).PopUpformData.status || "",
          sysName: (this as any).PopUpformData.system || "",
          location: (this as any).PopUpformData.location || "",
          modle: (this as any).PopUpformData.modle || "",
          production_num: (this as any).PopUpformData.production_num || "",
          production_date: (this as any).PopUpformData.production_date || "",
          remark: (this as any).PopUpformData.remark || "",
          run_date: (this as any).PopUpformData.run_date || "",
          scgj: (this as any).PopUpformData.scgj || "",
          stationId: (this as any).PopUpformData.stationId || "",
          stationName: this.bdzmcs((this as any).PopUpformData.stationId) || "",
          deviceId: "",
          sysCode: "",
        };
        (this as any).$services
          .insertFkDevice({ data: froms, method: "post" })
          .then((result: any) => {
            // console.log(result);
            if (result.code === 200) {
              this.$message({
                showClose: true,
                message: result.message,
                type: "success",
              });
              this.init();
            } else {
              this.$message({
                showClose: true,
                message: result.message,
                type: "warning",
              });
            }
          })
          .catch((err: object) => {
            console.log(err);
          });
        this.init();
      }
      if (this.PopUptitle === "修改") {
        // if((this as any).PopUpformData.status !==""){
        //     console.log(this.getTypeChange());
        // }
        let from = {
          area: (this as any).PopUpformData.area,
          deviceName: (this as any).PopUpformData.deviceName,
          deviceType: (this as any).PopUpformData.deviceType,
          status: (this as any).PopUpformData.status,
          system: (this as any).PopUpformData.system,
          location: (this as any).PopUpformData.location,
          modle: (this as any).PopUpformData.modle,
          production_num: (this as any).PopUpformData.production_num,
          production_date: (this as any).PopUpformData.production_date,
          remark: (this as any).PopUpformData.remark,
          run_date: (this as any).PopUpformData.run_date,
          scgj: (this as any).PopUpformData.scgj,
          stationId: (this as any).PopUpformData.stationId,
          stationName: (this as any).PopUpformData.stationName,
          deviceId: (this as any).multipleSelection[0].deviceId,
        };
        (this as any).$services
          .updateFkDevice({ data: from, method: "post" })
          .then((result: any) => {
            // console.log(result);
          })
          .catch((err: object) => {
            console.log(err);
          });

        this.init();
      }
      Object.keys(this.PopUpformData).forEach((key: string) => {
        this.PopUpformData[key] = "";
      });
      this.dialogVisible = false;
    });
  }

  mounted() {
    this.init();
    this.formData.cities = this.bdzId;
    // 所属区域
    this.formData.sideShot = this.parentId || "";
    //变电站下拉
    // console.log(this.treeSbSsdsId);

    (this as any).$services
      .getStationList({ data: { ssds: this.treeSbSsdsId } })
      .then((result: any) => {
        this.stationList = result.data;
        // console.log(result);
      })
      .catch((err: object) => {
        console.log(err);
      });
  }
}
</script>

<style lang="scss" scoped>
.RightFzjkDetails {
  width: 100%;
  height: 100%;

  .elForm-box {
    padding: 0.24rem 0.2rem 0 0;
  }
  .inspection-report-index-btn {
    display: flex;
    padding-left: 0.46rem;
    padding-top: 0.02rem;
    .el-button + .el-button {
      margin-left: 0.1rem;
    }
  }
  .tableed {
    width: 100%;
    height: calc(100% - 2.37rem);
  }
  .paged {
    width: 100%;
    height: 0.6rem;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  .buttom-box {
    display: flex;
    justify-content: center;
    align-items: center;
    > .el-button {
      margin: 0 0.6rem;
    }
  }
  #file0 {
    display: none;
  }
}
</style>
<style lang="scss">
.RightFzjkDetails {
  .inspection-report-index-btn {
    .el-button {
      padding: 0.12rem 0.2rem;
    }
  }
  .el-form-item {
    margin-bottom: 0.22rem;
  }
  .el-form-item--medium .el-form-item__content,
  .el-form-item--medium .el-form-item__label {
    line-height: 0.36rem;
  }
  .popUp-from {
    .el-form-item {
      margin-bottom: 0.35rem;
    }
  }
  .el-dialog {
    // height: 5.88rem;
  }
  .el-dialog__body {
    height: calc(100% - 44px);
  }
  //导入
  .el-upload-list {
    display: none;
  }
  .el-upload {
    margin: 0 0.1rem;
  }
}
</style>
